package com.geek.base.ch02.videodemo;

import java.util.Scanner;

/*
 *@Date 2025/11/8
 *@Author wangpeng
 *@Description TODO
 */
public class BreakTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int key = (int)(Math.random()*10+1);
        System.out.println("key = "+key);
        A:for (int i = 0; i < 3; i++) {
            System.out.println("请输入您的数字：");
            int num = sc.nextInt();
            B:for (int j = 0; j < 5; j++) {
                if(key==num+j){
                    System.out.println("num = "+num);
                    System.out.println("成功了");
                    //跳出当前循环 break
                    //跳出指定循环 break A
                    break A;
                }
            }
        }
    }
}
